package com.heu.blood.security.controller;

import java.util.Arrays;
import java.util.Map;


import com.heu.blood.common.utils.PageUtils;
import com.heu.blood.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.heu.blood.security.entity.BloodRightEntity;
import com.heu.blood.security.service.BloodRightService;




/**
 * 
 *
 * @author lyj
 * @email lyj@heu.com
 * @date 2025-02-10 22:24:16
 */
@RestController
@RequestMapping("security/bloodright")
public class BloodRightController {
    @Autowired
    private BloodRightService bloodRightService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = bloodRightService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		BloodRightEntity bloodRight = bloodRightService.getById(id);

        return R.ok().put("bloodRight", bloodRight);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody BloodRightEntity bloodRight){
		bloodRightService.save(bloodRight);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody BloodRightEntity bloodRight){
		bloodRightService.updateById(bloodRight);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		bloodRightService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
